<template>
  <div class="department">
    <PageSearch
      @query-click="handleQueryClick"
      @reset-click="handleResetClick"
    ></PageSearch>
    <PageContent
      @edit-click="handleEditClick"
      @new-click="handleNewClick"
      ref="contentRef"
    />
    <PageModal ref="modelRef"></PageModal>
  </div>
</template>

<script setup lang="ts" name="department">
import PageSearch from './c-cpns/page-search.vue'
import PageContent from './c-cpns/page-content.vue'
import PageModal from './c-cpns/page-modal.vue'

import { ref } from 'vue'
const contentRef = ref<InstanceType<typeof PageContent>>()
// 搜索
function handleQueryClick(queryInfo: any) {
  // 发送网络请求
  contentRef.value?.fetchPageListData(queryInfo)
}
function handleResetClick() {
  contentRef.value?.fetchPageListData()
}
const modelRef = ref<InstanceType<typeof PageModal>>()
function handleNewClick() {
  // 新建
  modelRef.value?.setDialogVisible(true)
}
function handleEditClick(itemData: any) {
  // 编辑
  modelRef.value?.setDialogVisible(false, itemData)
}
</script>

<style scoped>
.department {
}
</style>
